/*
 * @lc app=leetcode.cn id=551 lang=typescript
 *
 * [551] 学生出勤记录 I
 */

// @lc code=start
function checkRecord(s: string): boolean {
    let lateCount = 0;
    let ACount = 0;
    for (const iterator of s) {
        if (iterator === "A") {
            // 缺勤居然可以卡 BUG
            // ALL 是可以获奖的
            lateCount = 0;
            ACount++;
            if (ACount >= 2) return false;
        } else if (iterator === "L") {
            lateCount++;
            if (lateCount >= 3) return false;
        } else {
            lateCount = 0;
        }
    }
    return true;
}
// @lc code=end
